import React from 'react'
import actionCreators from '../store/actionCreators/counter2'
import {useSelector ,useDispatch, useBoundDispatch } from '../react-redux'

function Counter2(){
    const state = useSelector(state=>state.counter2)
    // const dispatch = useDispatch()
    const {add2, minus2} =useBoundDispatch(actionCreators)
        return (<div>
            <p>{state.number}</p>
            {/* <button onClick={()=>dispatch(actionCreators.add2()) }>+</button>
            <button onClick={ ()=>dispatch(actionCreators.minus2()) }>-</button> */}
            <button onClick={add2}>+</button>
            <button onClick={minus2}>-</button>
        </div>)
}


export default Counter2